<?php

namespace Yolo\Logs;

use Yolo\Di\Annotations\Singleton;
use Yolo\Utils\Console;

#[Singleton]
class ConsoleLog implements LogInterface
{

    /**
     * @psalm-param array{
     *     action: string,
     *     message: string,
     *     data?: array<string, mixed>
     * } $log
     * @param array $log
     * @return void
     */
    public function debug(array $log): void
    {
        Console::log(json_encode($log), 'debug');
    }

    public function info(array $log): void
    {
        Console::log(json_encode($log));
    }

    public function warn(array $log): void
    {
        Console::log(json_encode($log), 'warning');
    }

    public function error(array $log): void
    {
        Console::log(json_encode($log), 'error');
    }
}
